#include <iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    while (n--)
    {
        int k,i;
        double GPA=0,t=0;
        cin>>k;
        double c[k],s[k];
        char str[40];
        for (i=0;i<k;i++)cin>>str>>c[i]>>s[i];
        for (i=0;i<k;i++)
        {
            GPA+=c[i]*s[i];t+=c[i];
            if (s[i]<60){GPA=-1;break;}
        }
        if (GPA==-1)cout<<"Sorry!"<<endl;
        else
        {
            printf("%.2f\n",GPA/t);
        }
        if (n!=0)cout<<endl;
    }
    return 0;
}